from selenium.webdriver.common.by import By

from lagou.selenium_exercise.po.add_member_page import AddMemberPage
from lagou.selenium_exercise.po.base_page import BasePage


class ContactPage(BasePage):
    _base_url = "https://work.weixin.qq.com/wework_admin/frame#contacts"
    def click_add_member(self):
        """
        跳转到添加成员页面
        :return:返回添加成员页的实例化对象
        """
        self.driver.find_elements_by_css_selector(".js_has_member .js_add_member")[1].click()

        return AddMemberPage(self.driver)

    def get_member_list(self):
        """
        获取成员列表
        :return:返回用于断言的成员列表信息
        """

        ele = self.driver.find_elements(By.CSS_SELECTOR, ".member_colRight_memberTable_td:nth-child(2)")
        # 通过列表推导式获取列表数据信息
        name_list = [i.text for i in ele]
        print(name_list)
        return name_list